<template>
  <div class="retreat-reason">
    <div>审核退回原因</div>
    <div style="margin-top:10px">
      <el-input v-model="reasonText" size="medium" type="textarea" :rows="5" resize="none" style="width:100%">
      </el-input>
    </div>
    <div style="margin-top:20px;text-align:center">
      <el-button size="medium" type="primary" @click="ensure">确定</el-button>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        reasonText: ''
      };
    },

    methods: {
      ensure() {
        let reasonText = this.reasonText;
        if (reasonText.trim() === '') {
          this.$alert('请输入退回原因', '信息');
          return;
        }
        this.$emit('ensure', reasonText);
      },

      getData() {
        let reasonText = this.reasonText;
        reasonText = _.escape(reasonText);
        reasonText = reasonText.replace(/\n/g, '<br>').replace(/ /g, '&nbsp;');
        return reasonText;
      }
    }
  };

</script>

<style lang="scss" scoped>
  .retreat-reason {
    padding: 0 10px;
  }

</style>
